package componentes;

public class Coordenada {
	
	private final int x;
	private final int y;

	public Coordenada(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int getX() { return x; }
	public int getY() { return y; }
	
	public boolean esIgual(Coordenada c){
		//System.out.println((x == c.x && y == c.y)+"--" + "x " +x +"y "+ y);
		return x == c.x && y == c.y;
	}

	public Coordenada coordenadaNorte(){
		return new Coordenada(x,y+1);
	}
	
	public Coordenada coordenadaSur(){
		return new Coordenada(x,y-1);
	}
	
	public Coordenada coordenadaEste(){
		return new Coordenada(x+1,y);
	}
	
	public Coordenada coordenadaOeste(){
		return new Coordenada(x-1,y);
	}
	
	public Coordenada coordenadaNoreste(){
		return new Coordenada(x+1,y+1);
	}
	
	public Coordenada coordenadaSureste(){
		return new Coordenada(x+1,y-1);
	}
	
	public Coordenada coordenadaSuroeste(){
		return new Coordenada(x-1,y-1);
	}
	
	public Coordenada coordenadaNoroeste(){
		return new Coordenada(x-1,y+1);
	}
	
	public void print(){
		System.out.println("<"+x+","+y+">");
	}
	
	public boolean coordenadaSur(int tamTablero){
		return (y<=tamTablero/2);
	}
	
}
